// var QcloudSms = require("qcloudsms_js");
// var appid = '1400109336'
// var appkey = '972e64e3afe0df33c06fbd7386379960'
// var qcloudsmscase = QcloudSms(appid, appkey);
const templateID = 'SMS_145950026'
const accessKeyId  = 'LTAICFVBxqGtEROi'
const secretAccessKey  = 'NYIsMUb8lGFWJkBiZ51G2nliwCKHmP'
const SMSClient = require('@alicloud/sms-sdk')
let smsClient = new SMSClient({accessKeyId, secretAccessKey})

module.exports.sendVerification =  function sendVerification(code,phone,callback){

	smsClient.sendSMS({
		PhoneNumbers : String(phone),
		SignName : '潮剪',
		TemplateCode : templateID,
		TemplateParam : '{"code":"' + String(code) + '"}'
	}).then(function (res) {
		console.log(res,'ahha res')
		if (res.Code === 'OK') {
        //处理返回参数
        	callback(200)
    	}
    	else{
    		callback(400)
    	}
}, function (err) {
	console.log(err,'ahha resxx')
	callback(400)
})

		// var ssender = qcloudsmscase.SmsSingleSender();
		// var params = [code]
		// console.log(code,phone,'dsdsds')
		// ssender.sendWithParam( 86, phone, templateID,
		// 	  [String(code)],'',"", "", function(err,res,resData){
		// 	  	callback(err,res,resData)

		// 	})
	}

